package com.wptk.filemanager.model.file;

import android.text.TextUtils;

import java.io.File;
import java.io.Serializable;

/**
 * @创建人 chaychan
 * @创建时间 2016/7/23  18:11
 * @描述 文件,可以是文档、apk、压缩包
 */
public class FileBean implements Serializable {
    private String fileName;
    /** 文件的路径*/
    private String filePath;
    /**文件图片资源的id，drawable或mipmap文件中已经存放doc、xml、xls等文件的图片*/
    private int iconId;
    private long size;
    private long date;

    public FileBean(String path, int iconId) {
        this.filePath = path;
        this.iconId = iconId;
    }

    public String getFileName() {
        if(fileName == null || TextUtils.isEmpty(fileName))
            fileName = filePath.substring(filePath.lastIndexOf(File.separator) + 1);
        return fileName;
    }

    public void setFileName(String fileName) {
        this.fileName = fileName;
    }

    public String getFilePath() {
        return filePath;
    }

    public void setFilePath(String filePath) {
        this.filePath = filePath;
    }

    public int getIconId() {
        return iconId;
    }

    public void setIconId(int iconId) {
        this.iconId = iconId;
    }

    public long getSize() {
        return size;
    }

    public void setSize(long size) {
        this.size = size;
    }

    public long getDate() {
        return date;
    }

    public void setDate(long date) {
        this.date = date;
    }

    @Override
    public String toString() {
        return "FileBean{" +
                "fileName='" + fileName + '\'' +
                ", filePath='" + filePath + '\'' +
                ", iconId=" + iconId +
                ", size=" + size +
                ", date=" + date +
                '}';
    }
}
